//
//  MsgCenterViewController.m
//  yigou
//
//  Created by wangdianlei on 2017/1/12.
//  Copyright © 2017年 hanyiwang. All rights reserved.
//

#import "MsgCenterViewController.h"
#import "SystemInfoViewController.h"
#import "CommentViewController.h"
#import "ThumpViewController.h"
#import "FansViewController.h"
#import "PrivateLetterViewController.h"

@interface MsgCenterViewController () <UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation MsgCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIView *blankView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 1)];
    self.tableView.tableFooterView = blankView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [ViewFactory setNavigationBlack:self];
    self.navigationItem.titleView = [ViewFactory makeNavigationTitle:@"消息中心"];
    
//    UIBarButtonItem *backBtn = [ViewFactory makeNavigationBackWhite:self action:@selector(goPop)];
//    self.navigationItem.leftBarButtonItem = backBtn;
    
//    UIButton *button = [ViewFactory makeNavigationTextButtonWhite:@"发私信"];
//    [button addTarget:self action:@selector(goPop) forControlEvents:UIControlEventTouchUpInside];
//    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:button];
//    self.navigationItem.rightBarButtonItem = rightButton;
}

- (void)goPop {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setCellStyle:(UITableViewCell *)cell {
    cell.textLabel.textColor = [UIColor colorWithHexString:@"3d3d3d"];
    cell.textLabel.font = [FontTool fontWithSize:14];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    switch (indexPath.row) {
        case 0: {
            UITableViewCell *cell = GET_SYSTEM_CELL(Default, @"setdefault");
            [self setCellStyle:cell];
            cell.textLabel.text = @"私信";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            return cell;
        }
        case 1: {
            UITableViewCell *cell = GET_SYSTEM_CELL(Default, @"setdefault");
            [self setCellStyle:cell];
            cell.textLabel.text = @"评论我的";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            return cell;
        }
        case 2: {
            UITableViewCell *cell = GET_SYSTEM_CELL(Default, @"setdefault");
            [self setCellStyle:cell];
            cell.textLabel.text = @"点赞我的";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            return cell;
        }
        case 3: {
            UITableViewCell *cell = GET_SYSTEM_CELL(Default, @"setdefault");
            [self setCellStyle:cell];
            cell.textLabel.text = @"关注我的";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            return cell;
        }
        
        default:
            break;
    }
    return nil;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     if (indexPath.row == 0) {
        EaseConversationListViewController *chatController = [[EaseConversationListViewController alloc] init];
        [self.navigationController pushViewController:chatController animated:YES];
        
//        PrivateLetterViewController *systenInfo = [[PrivateLetterViewController alloc]init];
//        [self.navigationController pushViewController:systenInfo animated:YES];
    } else if (indexPath.row == 1) {
        CommentViewController *systenInfo = [[CommentViewController alloc]init];
        [self.navigationController pushViewController:systenInfo animated:YES];
    } else if (indexPath.row == 2) {
        ThumpViewController *systenInfo = [[ThumpViewController alloc]init];
        [self.navigationController pushViewController:systenInfo animated:YES];
    } else {
        FansViewController *systenInfo = [[FansViewController alloc]init];
        [self.navigationController pushViewController:systenInfo animated:YES];
    }
}

@end
